package com.paas.form.core.model.js;

import com.paas.form.core.model.ElementUI;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Collections;

@EqualsAndHashCode(callSuper = true)
@Data
public class Script extends ElementUI {


    public Script(int indentNum) {
        this.indentNum = indentNum;
    }

    @Override
    public void getElHtml(StringBuilder str) {

    }

    @Override
    public void getStartTagElHtml(StringBuilder str) {
        str.append("\n");
        String codeTemplate = String.join("", Collections.nCopies(indentNum, "\t")) + "<script>";
        str.append(codeTemplate);
        str.append("\n");
    }

    @Override
    public void getEndTagElHtml(StringBuilder str) {
        String codeTemplate = String.join("", Collections.nCopies(indentNum, "\t")) + "</script>\n"+"<style scoped>\n" +
                "\t.com_main .el-form-item--small.el-form-item {\n" +
                "\t\tmargin-bottom: 18px;\n" +
                "\t}\n" +
                "</style>";
        str.append(codeTemplate);
        str.append("\n");
    }
}